package com.antler.smt.portal.controller;

import com.antler.smt.portal.annotation.OperateCut;
import com.antler.smt.response.admin.GetOrderLogisticsResp;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.portal.OrderLogisticsService;
import com.antler.smt.utils.LogUtil;
import com.antler.smt.validate.DataValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 物流信息
 *
 * @author zhangyi
 * @date 2018/4/24 17:24
 */
@RestController
@RequestMapping("/orderLogistics")
@Api(description = "查看物流信息")
public class OrderLogisticsController {

    /**
     * 日志
     */
    private static Logger log = LogUtil.get();

    @Resource
    private OrderLogisticsService orderLogisticsService;

    /**
     *  查看订单物流信息
     *
     * @return
     */
    @PostMapping("/showOrderLogistics")
    @ApiOperation(value = "查看订单物流信息", httpMethod = "POST")
    @OperateCut(operationContent = "查看订单物流信息")
    public Result<GetOrderLogisticsResp> showOrderLogistics(@RequestParam(value = "orderId") Long orderId){

        DataValidator.isBlank(String.valueOf(orderId),"订单id不能为空！");
        Result result = null;
            result = orderLogisticsService.getOrderLogisticsInfo(orderId);
        return result;
    }
    /**
     *  查询实时物流信息
     *
     * @return
     */
    @PostMapping("/actualTimelogisticsInfo")
    @ApiOperation(value = "查看实时的订单物流信息", httpMethod = "POST")
    @OperateCut(operationContent = "查看实时的订单物流信息")
    public Result actualTimelogisticsInfo(@RequestParam(value = "orderId") Long orderId){

        DataValidator.isBlank(String.valueOf(orderId),"订单id不能为空！");
        Result result = null;
        //...
        return result;
    }
}
